/**
*  \file assertor.h
*
*  \brief Macro interface for exception handling.
*
*  \author Michael J. Hohmann <michael..hohmann@linde-mh.de>
*
*/

#ifndef ASSERTOR_H_INCLUDED
#define ASSERTOR_H_INCLUDED

/*================================================[ public includes  ]================================================*/
#include "../cfg/prj.h"
#include "../cfg/assertor_cfg.h"
/*================================================[ public defines   ]================================================*/

/** Deprecated Compile Timer Assertion.
*
* 	This macro is useful to assure a condition that is available at compile time.
*
*   \param condition Condition that have to be true, otherwise a compiler error will be generated.
*
*   \attention This macro is deprecated and should not be used in new projects. Use ASSERTOR_COMPILE_TIME()
*   		   instead.
*   \deprecated
*
*/
#define ASSERT_COMPILE_TIME( condition ) extern char assertion_is_not_correct[ (condition) ? 0 : -1 ]

/** Compile Timer Assertion.
*
* 	This macro is useful to assure a condition that is available at compile time.
*
*   \param condition Condition that have to be true, otherwise a compiler error will be generated.
*
*/
#define ASSERTOR_COMPILE_TIME( condition ) extern char assertion_is_not_correct[ (condition) ? 0 : -1 ]


/** Illegal Default Protector.
*
*  The macro ASSERTOR_ILLEGAL_DEFAULT() should be used in every switch statement where it is not allowed to
*  enter the default case.
*
*   \param explanation Explanation of issue.
*/
#define ASSERTOR_ILLEGAL_DEFAULT( explanation )	ASSERTOR_ILLEGAL_DEFAULT_CALL( explanation )

/** Require Precondition
*
*  The macro ASSERTOR_PRE() checks the passed condition. If the condition is FALSE the function will not return and
*  stop the program execution.
*
*   \param condition Condition to be checked.
*   \param explanation Explanation of the Precondition
*/
#define ASSERTOR_PRE( condition, explanation )    ASSERTOR_PRE_CALL( condition, explanation )

/** Ensure Postcondition
*
*  The ESR Macro checks the passed condition. If the condition is FALSE the function will not return and
*  stop the program execution.
*
*   \condition condition Condition to be checked.
*   \explanation Explanation of the Postcondition
*/
#define ASSERTOR_POST( condition, explanation )    ASSERTOR_POST_CALL( condition, explanation )

/** Check Invariant
*
*  The INV Macro checks the passed condition. If the condition is FALSE the function will not return and
*  stop the program execution.
*
*   \condition condition Condition to be checked.
*   \explanation Explanation of the Invariant
*/
#define ASSERTOR_INV( condition, explanation )    ASSERTOR_INV_CALL( condition, explanation )

/** Check Condition
*
*  The CHK Macro checks the passed condition. If the condition is FALSE the function will not return and
*  stop the program execution.
*
*   \condition condition Condition to be checked.
*   \explanation Explanation of the runtime check
*/
#define ASSERTOR_CHK( condition, explanation )    ASSERTOR_CHK_CALL( condition, explanation )

/*====================================================================================================================*/

#endif

/***********************************************************************************************************************
*                             Copyright 2014 Linde Material Handling. All rights reserved.                             *
***********************************************************************************************************************/
